<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="org.apache.shiro.web.filter.authc.FormAuthenticationFilter"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    <title>用户登录</title>
<link rel="stylesheet" type="text/css" href="<%=basePath %>css/styles.css">
  </head>
  <body>
  <div class="container">
    <div class="login">
      <h1><b>登录</b></h1>
    <form action="sign_in" method="post">
        <p><label>登录名：</label><input style="width:230px;" type="text" name="loginName" value="" placeholder="用户名"><span style="color:red"></span></p>
        <p><label>密&nbsp;&nbsp;&nbsp;码：</label><input style="width:230px;" type="password" name="loginPassword" value="" placeholder="密码"><span style="color:red"></span></p>
        <p><label>验证码：</label><input type="text" name="captcha" value="" placeholder="验证码" style="width:100px;">
        <img src="captcha" style="cursor:pointer;" id="validateImg"/><span style="color:red"></span>
        </p>
        <p class="remember_me">
          <label>
          </label> 
        </p>
        <p class="submit"><input type="button" name="commit" value="登录"></p>
      </form>
    </div>
    <div class="login-help">
      <p><a href="index.html">点击重置</a>.</p>
    </div>
  </div>
  </body>
</html>
<script type="text/javascript" src="<%=basePath%>js/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="<%=basePath%>/js/showBo.js"></script>
<script type="text/javascript" src="${ctx }/js/jquery.validate.js"></script>
<script type="text/javascript">
	$(document).ready(function(){
		$("input[type='button']").click(function(){
			var result=true;
			$("input").each(function(){
				if($(this).attr('name')=="loginName" && $(this).val()==""){
					$(this).next().text("请输入用户名！");
					result=false;	
				}
				if($(this).attr('name')=="loginPassword" && $(this).val()==""){
					$(this).next().text("请输入密码！");
					result=false;
				}
				if($(this).attr('name')=="captcha" && $(this).val()==""){
					$(this).next().text("请输入验证码！");
					result=false;
				}
			});
			if(result){
				$("form").submit();	
			}
		})
		if(${result!=null}){
			alert("${result}")
		}
	})
</script>
